﻿namespace BatchQueryWebApi.Models
{
    // 设备状态结果模型
    public class DeviceStatusResult
    {
        public string DeviceId { get; set; }
        public string Status { get; set; }
        public bool Success { get; set; }
        public string Message { get; set; }
        public DateTime QueryTime { get; set; }
        public DateTime EndQueryTime { get; set; }
        public double Duration => GetDuration();
        private double GetDuration()
        {
            var duration = (EndQueryTime - QueryTime).TotalMilliseconds;
            if (duration <= 0d)
            {
                return 0d;
            }

            return duration;
        }
    }
}
